package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.vo.UserWorkRoomExcludeWhiteListRankVO;
import com.sc.nft.mapper.UserWorkRoomDownMapper;
import com.sc.nft.entity.UserWorkRoomDown;
import com.sc.nft.service.UserWorkRoomDownService;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * (UserWorkRoomDown)表Dao层
 *
 * @author 王伟成
 * @since 2024-04-09 10:45:03
 */
@Slf4j
@Repository
public class UserWorkRoomDownDao extends ServiceImpl<UserWorkRoomDownMapper, UserWorkRoomDown> {

    public List<UserWorkRoomDown> selectList() {
        LambdaQueryWrapper<UserWorkRoomDown> queryWrapper = new LambdaQueryWrapper<>();
        return this.baseMapper.selectList(queryWrapper);
    }

    public List<UserWorkRoomExcludeWhiteListRankVO> communityNetworkUpgrade() {
        return this.baseMapper.communityNetworkUpgrade();
    }
    public UserWorkRoomDown getUserId(Long userId) {
        LambdaQueryWrapper<UserWorkRoomDown> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(UserWorkRoomDown::getUserId, userId);
        queryWrapper.last("limit 1");
        return this.baseMapper.selectOne(queryWrapper);
    }
}
